<!--{__NOLAYOUT__}-->
{include file="../application/admin/view/template/header.html" /}

<style>
    #auth {
        margin: 10px;
    }

    #auth .layui-form-checkbox {
        margin: 5px;
    }
</style>



<div id="auth">
    <form class="layui-form">
        <input type="hidden" value="{$uid}">
        {foreach $auth_groups as $vo}
        {if $vo.status=='1'}
        <input lay-filter="auth_ck" type="checkbox" name="auth[]" checked title="{$vo.title}" value="{$vo.id}">
        {else/}
        <input lay-filter="auth_ck" type="checkbox" name="auth[]" title="{$vo.title}" value="{$vo.id}">
        {/if}
        {/foreach}
    </form>
</div>




<script>
    layui.use(['form','layer'], function () {
        var form=layui.form;
        var uid=$('input[type="hidden"]').val();
        form.on('checkbox(auth_ck)', function(data){
            $.ajax({
                type:'post'
                ,url:'/admin/user/auth'
                ,data:{auth:data.value,value:data.elem.checked,uuid:uid}
                ,dataType:'json'
                ,sync:true
                ,success:function (data) {
                    if (data=='ok') {
                        layer.msg('设置成功');
                    }
                }
            });
        });
    });
</script>